package org.apache.flink.runtime.messages;

import java.io.Serializable;

import org.apache.flink.runtime.resourceconsumer.ConsumeAttemptID;
import org.apache.flink.util.Preconditions;

/** Response to the task back pressure request rpc call. */
public class TaskBackPressureResponse implements Serializable {

    private static final long serialVersionUID = -4786454630050578031L;

    private final int requestId;

    private final ConsumeAttemptID executionAttemptID;

    private final double backPressureRatio;

    public TaskBackPressureResponse(
            int requestId, ConsumeAttemptID executionAttemptID, double backPressureRatio) {
        this.requestId = requestId;
        this.executionAttemptID = Preconditions.checkNotNull(executionAttemptID);
        this.backPressureRatio = backPressureRatio;
    }

    public int getRequestId() {
        return requestId;
    }

    public ConsumeAttemptID getExecutionAttemptID() {
        return executionAttemptID;
    }

    public double getBackPressureRatio() {
        return backPressureRatio;
    }
}
